/**
 * Created by Lcp on 2017/7/23.
 */
var nowIndexs = 0,
    addList = [];

//附件上传
var nowIndex = 0;
var file = null;
var fileArray = [];
var imgArray = [];
var typeArray = [];
var sendMsg = [];
var yulan = document.getElementById('yulan');
var canvasShow = document.getElementById('canvasShow');
var Width = '';
var Height = '';
var t = '';
var tt = '';
$('#fileImg').mouseenter(function(){
    if(imgNum > 1){
        $('.arrow').fadeIn();
    }
});
$('#fileImg').mouseleave(function(){
    $('.arrow').fadeOut();
})

$('.fileEnclosures').mouseenter(function(){
    if(sendMsg.length > 1){
        $('.arrow').fadeIn();
    }
    if(sendMsg.length > 0){
        $('#del').fadeIn();
    }
});
$('.fileEnclosures').mouseleave(function(){
    $('.arrow').fadeOut();
    $('#del').fadeOut();
})

function carousel(obj){
    if(obj === 'next'){
        nowIndexs += 1;
        if(nowIndexs >= imgNum){
            nowIndexs = 0;
        }
        $('#allImg').stop().animate({
            marginLeft: -nowIndexs * $('#fileImg').width()
        }, 500);
        $('.allFileMsg').stop().animate({
            marginLeft: -nowIndexs * 500
        }, 500);
    }else{
        nowIndexs -= 1;
        if(nowIndexs < 0){
            nowIndexs = imgNum -1;
        }
        $('#allImg').stop().animate({
            marginLeft: -nowIndexs * $('#fileImg').width()
        }, 500);
        $('.allFileMsg').stop().animate({
            marginLeft: -nowIndexs * 500
        }, 500);
    }
}
function carousels(obj){
    Width = $('#yulan').width();
    if(obj === 'nexts'){
        nowIndex += 1;
        if(nowIndex >= sendMsg.length){
            nowIndex = 0;
        }
        $('#canvasShow').stop().animate({
            marginLeft: -nowIndex * Width
        }, 500);
        $('.allMessage').stop().animate({
            marginLeft: -nowIndex * $('.fileEnclosures .right').width()
        }, 500);
    }else{
        nowIndex -= 1;
        if(nowIndex < 0){
            nowIndex = sendMsg.length -1;
        }
        $('#canvasShow').stop().animate({
            marginLeft: -nowIndex * Width
        }, 500);
        $('.allMessage').stop().animate({
            marginLeft: -nowIndex * $('.fileEnclosures .right').width()
        }, 500);
    }
    drawCanvas(sendMsg[nowIndex],nowIndex);
}
//附件具体信息
function fileDetailMsg(){
    var peopleMsg = '<div class="fileMsg"><div class="group clearfix"><div class="form-group"><label><b>*</b>人数</label><select class="form-control Select fileOne"><option value="">请选择</option><option value="1人">1人</option><option value="2人">2人</option><option value="多人">多人</option><option value="未知">未知</option></select></div><div class="form-group"><label><b>*</b>年龄</label><select class="form-control Select fileTwo"><option value="">请选择</option><option value="青年">青年</option><option value="未成年">未成年</option><option value="中年">中年</option><option value="老年">老年</option><option value="未知">未知</option></select></div></div><div class="group clearfix"><div class="form-group"><label><b>*</b>性别</label><select class="form-control Select fileThree"><option value="">请选择</option><option value="男">男</option><option value="女">女</option><option value="未知">未知</option></select></div><div class="form-group"><label><b>*</b>身高</label><select class="form-control Select fileFour"><option value="">请选择</option><option value="160及以下">160及以下</option><option value="161-165">161-165</option><option value="166-170">166-170</option><option value="171-175">171-175</option><option value="176-180">176-180</option><option value="181-185">181-185</option><option value="186及以上">186及以上</option><option value="未知">未知</option></select></div></div><div class="group clearfix"><div class="form-group"><label><b>*</b>上衣颜色</label><select class="form-control Select fileFives"><option value="">请选择</option><option value="黑">黑</option><option value="白">白</option><option value="灰">灰</option><option value="红">红</option><option value="黄">黄</option><option value="蓝">蓝</option><option value="绿">绿</option><option value="紫">紫</option><option value="橙">橙</option><option value="无法识别">无法识别</option></select></div><div class="form-group"><label><b>*</b>上衣正面</label><select class="form-control Select fileFive"><option value="">请选择</option><option value="条纹">条纹</option><option value="商标">商标</option><option value="图案">图案</option><option value="无特征">无特征</option></select></div></div><div class="group clearfix"><div class="form-group"><label><b>*</b>上衣背面</label><select class="form-control Select fileSix"><option value="">请选择</option><option value="条纹">条纹</option><option value="商标">商标</option><option value="图案">图案</option><option value="无特征">无特征</option></select></div><div class="form-group"><label><b>*</b>上衣侧面</label><select class="form-control Select fileSeven"><option value="">请选择</option><option value="条纹">条纹</option><option value="商标">商标</option><option value="图案">图案</option><option value="无特征">无特征</option></select></div></div><div class="group clearfix"><div class="form-group form-groups"><label>上衣备注</label><input type="text" maxlength="512" onkeyup="valLength(this)" class="form-control Input fileEight" /></div></div><div class="group clearfix"><div class="form-group"><label><b>*</b>下身颜色</label><select class="form-control Select fileNine"><option value="">请选择</option><option value="黑">黑</option><option value="白">白</option><option value="灰">灰</option><option value="红">红</option><option value="黄">黄</option><option value="蓝">蓝</option><option value="绿">绿</option><option value="紫">紫</option><option value="橙">橙</option><option value="无法识别">无法识别</option></select></div><div class="form-group"><label><b>*</b>下身正面</label><select class="form-control Select fileTen"><option value="">请选择</option><option value="条纹">条纹</option><option value="商标">商标</option><option value="图案">图案</option><option value="无特征">无特征</option></select></div></div><div class="group clearfix"><div class="form-group"><label><b>*</b>下身背面</label><select class="form-control Select fileEleven"><option value="">请选择</option><option value="条纹">条纹</option><option value="商标">商标</option><option value="图案">图案</option><option value="无特征">无特征</option></select></div><div class="form-group"><label><b>*</b>下身侧面</label><select class="form-control Select fileTwelve"><option value="">请选择</option><option value="条纹">条纹</option><option value="商标">商标</option><option value="图案">图案</option><option value="无特征">无特征</option></select></div></div><div class="group clearfix"><div class="form-group form-groups"><label>下身备注</label><input type="text" maxlength="512" onkeyup="valLength(this)" class="form-control Input fileThirteen" /></div></div><div class="group clearfix"><div class="form-group"><label><b>*</b>鞋颜色</label><select class="form-control Select fileFourteen"><option value="">请选择</option><option value="黑">黑</option><option value="白">白</option><option value="灰">灰</option><option value="红">红</option><option value="黄">黄</option><option value="蓝">蓝</option><option value="绿">绿</option><option value="紫">紫</option><option value="橙">橙</option><option value="无法识别">无法识别</option></select></div><div class="form-group"><label><b>*</b>嫌疑人状态</label><select class="form-control Select fileFifteen"><option value="">请选择</option><option value="步行">步行</option><option value="驾驶汽车">驾驶汽车</option><option value="二轮车">二轮车</option><option value="未知">未知</option></select></div></div></div>',
        carMsg = '<div class="fileMsg"><div class="group clearfix"><div class="form-group"><label><b>*</b>车辆颜色</label><select class="form-control Select fileSeventeen"><option value="">请选择</option><option value="红">红</option><option value="蓝">蓝</option><option value="黄">黄</option><option value="绿">绿</option><option value="白">白</option><option value="灰">灰</option><option value="黑">黑</option><option value="其它">其它</option></select></div><div class="form-group"><label><b>*</b>型号</label><select class="form-control Select fileEighteen"><option value="">请选择</option><option value="大众">大众</option><option value="宝马">宝马</option><option value="奔驰">奔驰</option><option value="别克">别克</option><option value="本田">本田</option><option value="日产">日产</option><option value="哈弗">哈弗</option><option value="长城">长城</option><option value="其他">其他</option></select></div></div><div class="group clearfix"><div class="form-group"><label><b>*</b>二轮车</label><select class="form-control Select fileNineteen"><option value="">请选择</option><option value="电瓶车">电瓶车</option><option value="摩托车">摩托车</option><option value="自行车">自行车</option><option value="其它">其它</option></select></div><div class="form-group"><label><b>*</b>二轮车颜色</label><select class="form-control Select fileTwenty"><option value="">请选择</option><option value="红">红</option><option value="蓝">蓝</option><option value="黄">黄</option><option value="绿">绿</option><option value="白">白</option><option value="灰">灰</option><option value="黑">黑</option><option value="其它">其它</option></select></div></div><div class="group clearfix"><div class="form-group form-groups"><label>车牌</label><input type="text" class="form-control Input fileTwentyOne" /></div></div></div>',
        lostMsg = '<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>损失物品说明</label><input type="text" class="form-control Input fileTwentyTwo"></div></div></div>',
        getMsg = '<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>缴获物品说明</label><input type="text" class="form-control Input fileTwentyThree"></div></div></div>';
    return peopleMsg + carMsg + lostMsg + getMsg;
}
function getImgURL(node) {
    if(ajbh){
        Width = yulan.clientWidth;
        Height = yulan.clientHeight;
        //去除谷歌value为空判断改变上传
        if (node.value){
            if(node.files && node.files[0] ){
                file = node.files[0];
            }else if(node.files && node.files.item(0)) {
                file = node.files.item(0);
            }
            var kind = file.type;
            var fileReader = new FileReader();
            //去除重复上传
            if (fileArray.indexOf(file.name) >= 0){
                Msg('您已选择，如需重复选择请修改名称。');
            } else {
                if( file.size < fileSize){
                    $('#canvasShow').css('background', 'none');
                    fileArray.push(file.name);
                    //添加右侧的文字说明
                    $('.allMessage').css('background', 'none');
                    $('.allMessage').append('<div class="allMessageList"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明<b>*</b></label><select  class="form-control Select fileSelectType" onchange="chooseFileStyle(this)"><option value="">请选择</option><option value="嫌疑人">嫌疑人</option> <option value="车辆">车辆</option><option value="损失物品">损失物品</option><option value="缴获物品">缴获物品</option></select><input type="hidden" class="fileKind" value="'+ kind +'"></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补录</label><div class="enclosureT">'+ fileDetailMsg() +'</div></div></div></div>')
                    $('.allMessageList').css('width',$('.fileEnclosures .right').width() + 'px');
                    $('.allMessage').css('width',$('.allMessageList').length * $('.fileEnclosures .right').width() + 'px');
                    if (kind.indexOf("video") >= 0){
                        var video = '<img src="thread/img/video.jpg" alt="图片丢失" width=' + Width +' height=' + Height +' class="image" style="vertical-align: top">';
                        imgArray.push(video);
                        typeArray.push(1);
                        sendMsg.push(file);
                        closeLoading();
                        var i = imgArray.length - 1;
                        nowIndex = i;
                        $(canvasShow).append(video);
                        shows();
                    } else if(kind.indexOf("image") >= 0){
                        //canvas实现图片处理预览上传
                        fileReader.readAsDataURL(file);
                        fileReader.onprogress = function(event){
                            Loading();
                        }
                        fileReader.onload = function(event){
                            closeLoading();
                            var result = event.target.result;   //返回的dataURL
                            imgArray.push('canvas');
                            sendMsg.push(result);
                            typeArray.push(4);
                            canvasShow.style.width = Width * imgArray.length + 'px';
                            canvasShow.style.height = Height + 'px';
                            var i = imgArray.length - 1;
                            nowIndex = i;
                            $(canvasShow).append('<div style="width: '+ Width +'px;height: '+ Height +'px;text-align: center;display: inline-block;overflow: auto;" id="'+ i +'"></div>');
                            drawCanvas(result,i);
                            shows();
                            //var DataBase64 = {"picture_image_content_base64": newImageData};
                            //yitu(JSON.stringify(DataBase64));
                        };
                        fileReader.onerror = function( event) {
                            console.log('error')
                        }
                    }else {
                        var other = '<img src="thread/img/other.jpg" alt="图片丢失" width=' + Width +' height=' + Height +' class="image" style="vertical-align: top">';
                        imgArray.push(other);
                        typeArray.push(5);
                        // fileReader.readAsArrayBuffer(file);
                        // fileReader.onprogress =function(event){
                        //     Loading();
                        // }
                        // fileReader.onload=function(event){
                        //     sendMsg.push(event.target.result);
                        //     closeLoading();
                        // }
                        sendMsg.push(file);
                        closeLoading();
                        var i = imgArray.length - 1;
                        nowIndex = i;
                        $(canvasShow).append(other);
                        shows();
                    }
                } else {
                    Msg('您选择文件超' + (fileSize/1024/1024/1024).toFixed(2) + 'G,请重新选择');
                }
            }
        } else {

        }
    }else{
        Msg('请先选择左侧案件');
    }
    //清空file值
    var file = $('#fileInputs');
    file.after(file.clone().val(""));
    file.remove();
}
function shows(){
    canvasShow.style.width = Width * imgArray.length + 'px';
    canvasShow.style.height = Height + 'px';
    $('#canvasShow').animate({
        marginLeft: -nowIndex * Width
    }, 500)
    $('.allMessage').stop().animate({
        marginLeft: -nowIndex * $('.fileEnclosures .right').width()
    }, 500);
}
function caseSubTwo(){
    var sendImg = [],
        sendOther = [],
        imgWords = [],
        otherWords = [],
        imgName = [],
        otherName = [],
        imgType = [],
        otherType = [],
        FilesName = [],
        PhotosName = [],
        data = new Date(),
        newData = new Date(),
        length = 2,
        flag = true,
        unFill = '',
        checkstatus = 1;
    //管理员录入线索不审核直接通过。
    if($('#roleEnName').val() != 'ptyh'){
        checkstatus = 0;
    }
    //生成线索编号和取证明称
    if($('#ajqys').val() != '' && $('#ajqys').val() != null && ajbh != ''){
        if(sendMsg.length > 0){
            for(var i = 0; i< $('.allMessage .fileSelectType').length; i++){
                if($('.allMessage .fileSelectType').eq(i).val() != ''){
                    flag = true;
                } else {
                    flag = false;
                    unFill = i;
                    break;
                }
            }
        }
        if(flag){
            //获取附件说明
            var tpylzd7 = [],
                rs = [],
                nl = [],
                xb = [],
                sg = [],
                ssys = [],
                sszm = [],
                ssbm = [],
                sscm = [],
                ssbz = [],
                xsys = [],
                xszm = [],
                xsbm = [],
                xscm = [],
                xsbz = [],
                xys = [],
                xyrzt = [],
                jrspsj = [],
                lkspsj = [],
                csys = [],
                cllx = [],
                elc = [],
                elcys = [],
                cphm = [],
                sswp = [],
                jhwp = [];
            for(var i = 0; i < $('.allMessage .allMessageList').length; i++){
                    tpylzd7.push($('.allMessageList').eq(i).find('.fileSelectType').val());
                    if($('.allMessageList').eq(i).find('.fileSelectType').val() == '嫌疑人'){
                        var jrspsjString = '',
                            lkspsjString = '';
                        if($('.allMessageList').eq(i).find('.fileOne').val().length > 0){
                            rs.push($('.allMessageList').eq(i).find('.fileOne').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的人数信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileTwo').val().length > 0){
                            nl.push($('.allMessageList').eq(i).find('.fileTwo').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的年龄信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileThree').val().length > 0){
                            xb.push($('.allMessageList').eq(i).find('.fileThree').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的性别信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileFour').val().length > 0){
                            sg.push($('.allMessageList').eq(i).find('.fileFour').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的身高信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileFives').val().length > 0){
                            ssys.push($('.allMessageList').eq(i).find('.fileFives').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的上身颜色信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileFive').val().length > 0){
                            sszm.push($('.allMessageList').eq(i).find('.fileFive').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的上身正面信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileSix').val().length > 0){
                            ssbm.push($('.allMessageList').eq(i).find('.fileSix').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的上身背面信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileSeven').val().length > 0){
                            sscm.push($('.allMessageList').eq(i).find('.fileSeven').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的上身侧面信息');
                            return false;
                        }

                        ssbz.push($('.allMessageList').eq(i).find('.fileEight').val());

                        if($('.allMessageList').eq(i).find('.fileNine').val().length > 0){
                            xsys.push($('.allMessageList').eq(i).find('.fileNine').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的下身颜色信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileTen').val().length > 0){
                            xszm.push($('.allMessageList').eq(i).find('.fileTen').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的下身正面信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileEleven').val().length > 0){
                            xsbm.push($('.allMessageList').eq(i).find('.fileEleven').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的下身背面信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileTwelve').val().length > 0){
                            xscm.push($('.allMessageList').eq(i).find('.fileTwelve').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的下身侧面信息');
                            return false;
                        }

                        xsbz.push($('.allMessageList').eq(i).find('.fileThirteen').val());

                        if($('.allMessageList').eq(i).find('.fileFourteen').val().length > 0){
                            xys.push($('.allMessageList').eq(i).find('.fileFourteen').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的鞋子信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileFifteen').val().length > 0){
                            xyrzt.push($('.allMessageList').eq(i).find('.fileFifteen').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标人附件的嫌疑人状态信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileSixteen').val() != undefined ){
                            if($('.allMessageList').eq(i).find('.fileSixteen').val().length > 0){
                                jrspsjString = $('.allMessageList').eq(i).find('.fileSixteen').val().split('~')[0];
                                lkspsjString = $('.allMessageList').eq(i).find('.fileSixteen').val().split('~')[1];
                            }else{
                                Msg('请完善第' + (i+1) + '个附件的嫌疑人出现时间');
                                return false;
                            }
                        }
                        jrspsj.push(jrspsjString);
                        lkspsj.push(lkspsjString);

                        csys.push('');
                        cllx.push('');
                        elc.push('');
                        elcys.push('');
                        cphm.push('');

                        sswp.push('');

                        jhwp.push('');
                    }else if($('.allMessageList').eq(i).find('.fileSelectType').val() == '车辆'){
                        rs.push('');
                        nl.push('');
                        xb.push('');
                        sg.push('');
                        ssys.push('');
                        sszm.push('');
                        ssbm.push('');
                        sscm.push('');
                        ssbz.push('');
                        xsys.push('');
                        xszm.push('');
                        xsbm.push('');
                        xscm.push('');
                        xsbz.push('');
                        xys.push('');
                        xyrzt.push('');
                        jrspsj.push('');
                        lkspsj.push('');

                        if($('.allMessageList').eq(i).find('.fileSeventeen').val().length > 0){
                            csys.push($('.allMessageList').eq(i).find('.fileSeventeen').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标车附件的车身颜色信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileEighteen').val().length > 0){
                            cllx.push($('.allMessageList').eq(i).find('.fileEighteen').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标车附件的车辆型号信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileNineteen').val().length > 0){
                            elc.push($('.allMessageList').eq(i).find('.fileNineteen').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标车附件的二轮车信息');
                            return false;
                        }
                        if($('.allMessageList').eq(i).find('.fileTwenty').val().length > 0){
                            elcys.push($('.allMessageList').eq(i).find('.fileTwenty').val());
                        }else{
                            Msg('请完善第' + (i+1) + '个目标车附件的二轮车颜色信息');
                            return false;
                        }
                        cphm.push($('.allMessageList').eq(i).find('.fileTwentyOne').val());

                        sswp.push('');

                        jhwp.push('');
                    }else if($('.allMessageList').eq(i).find('.fileSelectType').val() == '损失物品'){
                        rs.push('');
                        nl.push('');
                        xb.push('');
                        sg.push('');
                        ssys.push('');
                        sszm.push('');
                        ssbm.push('');
                        sscm.push('');
                        ssbz.push('');
                        xsys.push('');
                        xszm.push('');
                        xsbm.push('');
                        xscm.push('');
                        xsbz.push('');
                        xys.push('');
                        xyrzt.push('');
                        jrspsj.push('');
                        lkspsj.push('');

                        csys.push('');
                        cllx.push('');
                        elc.push('');
                        elcys.push('');
                        cphm.push('');

                        sswp.push($('.allMessageList').eq(i).find('.fileTwentyTwo').val());

                        jhwp.push('');
                    }else if($('.allMessageList').eq(i).find('.fileSelectType').val() == '缴获物品'){
                        rs.push('');
                        nl.push('');
                        xb.push('');
                        sg.push('');
                        ssys.push('');
                        sszm.push('');
                        ssbm.push('');
                        sscm.push('');
                        ssbz.push('');
                        xsys.push('');
                        xszm.push('');
                        xsbm.push('');
                        xscm.push('');
                        xsbz.push('');
                        xys.push('');
                        xyrzt.push('');
                        jrspsj.push('');
                        lkspsj.push('');

                        csys.push('');
                        cllx.push('');
                        elc.push('');
                        elcys.push('');
                        cphm.push('');

                        sswp.push('');

                        jhwp.push($('.allMessageList').eq(i).find('.fileTwentyThree').val());
                    }
            }
            $.ajax({
                type: 'get',
                url: baseUrls + 'caseClue/num',
                data: {ajbh:ajbh},
                beforeSend: function () {
                    Loading();
                },
                success: function (response) {
                    if(response.responseCode == '1000'){
                        closeLoading();
                        var order = '000' + (response.content + 1);
                        if(response.content >= 9){
                            order = '00' + (response.content + 1);
                        }
                        if(response.content >= 99){
                            order = '0' + (response.content + 1);
                        }
                        if(response.content >= 999){
                            order = response.content + 1;
                        }
                        var xsmc = ajmc + '_线索_' + order;
                        data = '' + data.getFullYear() + (data.getMonth() + 1) + data.getDate() + data.getHours() + data.getMinutes() + data.getSeconds() + data.getMilliseconds();
                        var xsbh = "S" + $('#userCode').val() + '0000' + data + order;
                        var bh = xsbh.replace('S','W');
                        for(var i = 0; i< sendMsg.length; i++){
                            if(typeof sendMsg[i] == 'string'){
                                sendImg.push(sendMsg[i].replace('data:image/jpeg;base64,',''));
                                imgWords.push(
                                    {
                                        tpylzd7: tpylzd7[i],
                                        rs: rs[i],
                                        nl: nl[i],
                                        xb: xb[i],
                                        sg: sg[i],
                                        ssys: ssys[i],
                                        sszm: sszm[i],
                                        ssbm: ssbm[i],
                                        sscm: sscm[i],
                                        ssbz: ssbz[i],
                                        xsys: xsys[i],
                                        xszm: xszm[i],
                                        xsbm: xsbm[i],
                                        xscm: xscm[i],
                                        xsbz: xsbz[i],
                                        xys: xys[i],
                                        xyrzt: xyrzt[i],
                                        jrspsj: jrspsj[i],
                                        lkspsj: lkspsj[i],
                                        csys: csys[i],
                                        cllx: cllx[i],
                                        elc: elc[i],
                                        elcys: elcys[i],
                                        cphm: cphm[i],
                                        sswp: sswp[i],
                                        jhwp: jhwp[i]
                                    }
                                );
                                imgName.push(fileArray[i]);
                                imgType.push(typeArray[i]);
                                PhotosName.push(
                                    address + $('#orgCode').val().substr(0,6) + '/' + newData.getFullYear() + '/' + (newData.getMonth() + 1) + '/' + newData.getDate() + '/' + ajbh + '_' + $('#userCode').val() + '_' + newData.getHours() + newData.getMinutes() + newData.getSeconds() + newData.getMilliseconds() + '_' + i + fileArray[i].substr(fileArray[i].lastIndexOf('.')))
                            } else {
                                sendOther.push(sendMsg[i]);
                                otherWords.push(
                                    {
                                        tpylzd7: tpylzd7[i],
                                        rs: rs[i],
                                        nl: nl[i],
                                        xb: xb[i],
                                        sg: sg[i],
                                        ssys: ssys[i],
                                        sszm: sszm[i],
                                        ssbm: ssbm[i],
                                        sscm: sscm[i],
                                        ssbz: ssbz[i],
                                        xsys: xsys[i],
                                        xszm: xszm[i],
                                        xsbm: xsbm[i],
                                        xscm: xscm[i],
                                        xsbz: xsbz[i],
                                        xys: xys[i],
                                        xyrzt: xyrzt[i],
                                        jrspsj: jrspsj[i],
                                        lkspsj: lkspsj[i],
                                        csys: csys[i],
                                        cllx: cllx[i],
                                        elc: elc[i],
                                        elcys: elcys[i],
                                        cphm: cphm[i],
                                        sswp: sswp[i],
                                        jhwp: jhwp[i]
                                    }
                                );
                                otherName.push(fileArray[i]);
                                otherType.push(typeArray[i]);
                                FilesName.push(
                                    address + $('#orgCode').val().substr(0,6) + '/' + newData.getFullYear() + '/' + (newData.getMonth() + 1) + '/' + newData.getDate() + '/' + ajbh + '_' + $('#userCode').val() + '_' + newData.getHours() + newData.getMinutes() + newData.getSeconds() + newData.getMilliseconds() + '_' + i + fileArray[i].substr(fileArray[i].lastIndexOf('.'))
                                )
                            }
                        }
                        var formData = new FormData();
                        for(var i = 0; i < sendOther.length; i++){
                            formData.append('files', sendOther[i]);
                        }
                        formData.append('fileNames', FilesName);
                        formData.append('fileTypes', otherType);

                        formData.append('photos', sendImg);
                        formData.append('photoNames', PhotosName);
                        formData.append('photoTypes', imgType);
                        if(sendMsg.length > 0){
                            $.ajax({
                                type: 'post',
                                url: uploadUrl + 'upload',
                                contentType: false,
                                processData: false,
                                data: formData,
                                beforeSend: function () {
                                    $('.progress h4').html('正在解析准备上传');
                                    $('.progress').slideDown();
                                    if( sendMsg.length > 0) {
                                        t = setInterval(function(){
                                            $.ajax({
                                                type: 'post',
                                                url: uploadUrl + 'watchSchedule',
                                                data: {fileNames: FilesName},
                                                success: function(response){
                                                    if(response.responseCode == '1000'){
                                                        if(Math.floor(response.content[0] / sendOther[0].size) * 100 > 60){
                                                            $('.progress h4').html('正在上传，进度'  + Math.floor(response.content[0] / sendOther[0].size) * 100 + '%');
                                                            $('.progress .pros').css('width', response.content[0] / (sendOther[0].size) * 200 +  'px' );
                                                        } else {
                                                            length += 2;
                                                            if (length >= 60) {
                                                                length = 60;
                                                            }
                                                            $('.progress h4').html('正在上传,进度' + length + '%');
                                                            $('.progress .pros').css('width', length * 200 / 100 + 'px');
                                                        }
                                                    } else {
                                                        $('.progress h4').html('正在上传,进度' + length + '%');
                                                        $('.progress .pros').css('width', length * 200 / 100 + 'px');
                                                        length += 2;
                                                        if (length >= 60) {
                                                            length = 60;
                                                        }
                                                    }
                                                },
                                                error: function(){
                                                    console.log(1);
                                                }
                                            })
                                        },1000)
                                    } else {
                                        tt = setInterval(function(){
                                            $('.progress h4').html('正在上传,进度' + length + '%');
                                            $('.progress .pros').css('width', length * 200 / 100 + 'px');
                                            length += 1;
                                            if (length >= 100) {
                                                length = 100;
                                            }
                                        },1000)
                                    }
                                },
                                success: function (response) {
                                    clearInterval(t);
                                    clearInterval(tt);
                                    if(response.responseCode == '1000'){
                                        for(var i = 0; i < response.content.files.length; i++){
                                            otherWords[i].tpmc = response.content.files[i].fileName;
                                            otherWords[i].wllj = response.content.files[i].wllj;
                                            otherWords[i].gxlj = response.content.files[i].gxlj;
                                            otherWords[i].qzlx = response.content.files[i].type;
                                        }
                                        for(var i = 0; i < response.content.photos.length; i++){
                                            imgWords[i].tpmc = response.content.photos[i].fileName;
                                            imgWords[i].wllj = response.content.photos[i].wllj;
                                            imgWords[i].gxlj = response.content.photos[i].gxlj;
                                            imgWords[i].qzlx = response.content.photos[i].type;
                                        }
                                        var lastFile = otherWords.concat(imgWords);
                                        $('#mation-2').ajaxSubmit({
                                            type: 'post',
                                            url: baseUrls + 'caseClue/add',
                                            data: {
                                                bh: bh,
                                                qzmc: xsmc,
                                                ajbh: ajbh,
                                                qzbh: xsbh,
                                                tpList: JSON.stringify(lastFile),
                                                userCode: $("#userCode").val(),
                                                orgCode: $("#orgCode").val(),
                                                checkstatus: checkstatus,
                                                userid: $('#userId').val()
                                            },
                                            beforeSend: function(){
                                                $('.progress h4').html('正在上传，99%');
                                                $('.progress .pros').css('width',  199 + 'px');
                                            },
                                            success: function(responses){
                                                $('.progress h4').html('正在上传，进度100%');
                                                $('.progress .pros').css('width',  200 + 'px');
                                                setTimeout(function(){
                                                    if(responses.responseCode == '1000'){
                                                        getMsg(Obj);
                                                        if(checkstatus == 0){
                                                            Msg('已成功');
                                                        }else{
                                                            Msg('已成功，请等待审核');
                                                        }
                                                        $('.inFollow').css('display','none');
                                                        $('.unFollow').css('display', 'block');
                                                    } else{
                                                        clearInterval(t);
                                                        clearInterval(tt);
                                                        $('.progress').css('display','none');
                                                        Msg('已失败');
                                                    }
                                                    clearFile();
                                                    $('.progress').slideUp();
                                                },100)
                                            },
                                            error: function(){
                                                clearInterval(t);
                                                clearInterval(tt);
                                                $('.progress').css('display','none');
                                                Msg('已失败');
                                            }
                                        })
                                    } else {
                                        clearInterval(t);
                                        clearInterval(tt);
                                        $('.progress').css('display','none');
                                        Msg('已失败');
                                    }
                                },
                                error: function(){
                                    clearInterval(t);
                                    clearInterval(tt);
                                    $('.progress').css('display','none');
                                    Msg('已失败');
                                }
                            })
                        }else{
                            $('#mation-2').ajaxSubmit({
                                type: 'post',
                                url: baseUrls + 'caseClue/add',
                                data: {bh: bh, qzmc: xsmc, ajbh: ajbh, qzbh: xsbh,tpList: '',userCode: $("#userCode").val(), orgCode: $("#orgCode").val(),checkstatus: checkstatus,userid: $('#userId').val()},
                                beforeSend:function(){
                                    Loading();
                                },
                                success: function(responses){
                                    closeLoading();
                                    setTimeout(function(){
                                        if(responses.responseCode == '1000'){
                                            getMsg(Obj);
                                            $('.progress').css('display','none');
                                            if(checkstatus == 0){
                                                $('.clueContent-hoof').html('');
                                                for(var i = 0; i < responses.content.length; i++){
                                                    $('.clueContent-hoof').append('<li class="content" onclick="clueDetail(\''+ responses.content[i].qzbh +'\',this)"  onmouseup="shopping(this)" title="鼠标右键添加指令相关线索"><div class="div left">'+ nulls(responses.content[i].qzbh) +'</div><div class="div center">'+ nulls(responses.content[i].qzmc) +'</div><div class="div right"><b  onclick="removeClue(\'' + responses.content[i].xxid + '\', this, event)">删除</b><input type="hidden" class="lrrName" value="' + nulls(responses.content[i].xxylzd4) + '"><input type="hidden" class="sysorgcode" value="' + nulls(responses.content[i].sysorgcode) + '"></div></li>')
                                                }
                                                Msg('已成功');
                                            } else{
                                                Msg('已成功，请等待审核');
                                            }
                                            $('.inFollow').css('display','none');
                                            $('.unFollow').css('display', 'block');
                                        }else{
                                            Msg('已失败');
                                        }
                                        clearFile();
                                        $('.progress').slideUp();
                                    },100)
                                },
                                error: function(){
                                    closeLoading();
                                    $('.progress').css('display','none');
                                    Msg('已失败');
                                }
                            })
                        }
                    } else {
                        clearInterval(t);
                        clearInterval(tt);
                        $('.progress').css('display','none');
                        closeLoading();
                        Msg('已失败');
                    }
                },
                error: function(){
                    clearInterval(t);
                    clearInterval(tt);
                    $('.progress').css('display','none');
                    closeLoading();
                    Msg('已失败');
                }
            })
        }else{
            Msg('请完善第' + (unFill + 1) + '个附件的文件说明和补充说明信息');
        }
    } else{
        Msg('请先选择左侧案件,并且已选择案件区域')
    }
}
function clearFile(){
    nowIndex = 0;
    file = null;
    fileArray = [];
    imgArray = [];
    typeArray = [];
    sendMsg = [];
    Width = '';
    Height = '';
    $('#canvasShow').html('');
    $('.allMessage ').html('');
    $('#canvasShow').css({background:'url(thread/img/nothing.png) center center no-repeat',marginLeft: 0,width:$('.fileEnclosures .left').width() - 5 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
    $('.allMessage').css({background: 'url(thread/img/nothing.png) center center no-repeat',marginLeft: 0, width: $('.fileEnclosures .right').width() + 'px',height: 300});
}
//删除
function del(){
    fileArray.splice(nowIndex,1);
    imgArray.splice(nowIndex,1);
    typeArray.splice(nowIndex,1);
    sendMsg.splice(nowIndex,1);
    $('.allMessageList:eq(' + nowIndex + ')').remove();
    $('#canvasShow').children().eq(nowIndex).remove();
    nowIndex -= 1;
    if(nowIndex < 0){
        nowIndex = 0;
    }
    $('#canvasShow').stop().animate({
        marginLeft: -nowIndex * $('#yulan').width()
    }, 500);
    $('.allMessage').stop().animate({
        marginLeft: -nowIndex * 500
    }, 500);
    if(sendMsg.length > 1){
        $('.arrow').fadeIn();
    } else{
        $('.arrow').fadeOut();
    }
    $('#canvasShow').css({width:($('.fileEnclosures .left').width() - 5) * sendMsg.length + 'px'});
    $('.allMessage').css({width: $('.fileEnclosures .right').width() * sendMsg.length + 'px'});
    if(sendMsg.length == 0){
        $('.arrow').fadeOut();
        $('#del').fadeOut();
        $('#canvasShow').css({background: 'url(thread/img/nothing.png) center center no-repeat',width: $('.fileEnclosures .left').width() - 5 + 'px'});
        $('.allMessage').css({background: 'url(thread/img/nothing.png) center center no-repeat',width: $('.fileEnclosures .right').width() + 'px'});
    }
    //清空file值
    var file = $('#fileInputs');
    file.after(file.clone().val(""));
    file.remove();
}
function  cleared(item) {
    $.ajax({
        type: 'post',
        url: baseUrls + 'commandStore/delete',
        data: {userid: $('#userId').val(), infonum: $(item).parent().children('.firstSpan').html()},
        beforeSend: function(){
            Loading();
        },
        success: function(response){
            closeLoading();
            if(response.responseCode == '1000'){
                addList.splice($(item).parent().index(),1);
                $(item).parent().remove();
                if(addList.length > 0){
                    $('.num').text(addList.length);
                }else{
                    $('.num').text('');
                }
            }else{
                Msg('删除失败');
            }
        },
        error: function(){
            closeLoading();
            Msg('删除失败');
        }
    })
}
function shopping(item,evnet){
    var event = event ? event : window.event;
    if(event.which == 3){
        var index = $(item).children(".left").html();
        if(addList.indexOf(index) >= 0){
            Msg('您已添加');
        } else {
            var kind = 0,
                str = $(item).children(".left").html();
            if(str.indexOf('A') >= 0){
                kind = 0;
            }
            if(str.indexOf('S') >= 0){
                kind = 1;
            }
            $.ajax({
                type: 'post',
                url: baseUrls + 'commandStore/add',
                data: {
                    userid: $('#userId').val(),
                    infonum: $(item).children(".left").html(),
                    infoname: $(item).children(".center").html(),
                    cstype: kind
                },
                beforeSend: function(){
                    Loading();
                },
                success: function(response){
                    closeLoading();
                    if(response.responseCode == '1000'){
                        addList.push(index);
                        var flyElm = $(item).clone().css('opacity', '0.8');
                        flyElm.css({
                            zIndex: 9000,
                            display: 'block',
                            position: 'absolute',
                            top: $(item).offset().top + 'px',
                            left: $(item).offset().left + 'px',
                            width: $(item).width() + 'px',
                            height: $(item).height() + 'px',
                            color: 'transparent',
                            background: 'rgba(40,56,82,.5)',
                            '-webkit-box-shadow': '0 0 5px #0090e1 inset',
                            '-moz-box-shadow': '0 0 5px #0090e1 inset',
                            '-ms-box-shadow': '0 0 5px #0090e1 inset',
                            '-o-box-shadow': '0 0 5px #0090e1 inset',
                            'box-shadow': '0 0 5px #0090e1 inset'
                        });
                        $('body').append(flyElm);
                        flyElm.animate({
                                top: $('.shopping').offset().top,
                                left: $('.shopping').offset().left,
                                width: 2,
                                height: 2
                            },
                            500,
                            function(){
                                if(addList.length > 9){
                                    $('.num').text("+9");
                                } else{
                                    $('.num').text(addList.length);
                                }
                                $('.ul-contents').append('<li><span class="firstSpan">'+ $(item).children(".left").html() +'</span><span class="secondSpan">'+ $(item).children(".center").html() +'</span><span onclick="cleared(this)"><i class=" fa fa-minus" aria-hidden="true"></i></span></li>')
                                flyElm.remove();
                            })
                    } else {
                        closeLoading();
                        Msg('指令添加失败');
                    }
                },
                error: function(){
                    closeLoading();
                    Msg('指令添加失败');
                }
            })
        }
    }
}
function valLength(item){
    var length = $(item).val().length;
    if(length >= $(item).attr('maxLength')){
        Msg('最多允许输入'+ $(item).attr("maxLength") +'个字符');
    }
}
function follow(event){
    stopPro(event);
    if(ajbh != ''){
        $.ajax({
            type: 'post',
            url: baseUrls + 'attention/add',
            data: {
                yhm: $('#userId').val(),
                ajbh: ajbh
            },
            beforeSend: function (){
                Loading();
            },
            success:function(response){
                closeLoading();
                if(response.responseCode == '1000'){
                    Msg('关注成功');
                    $('.inFollow').css('display', 'none');
                    $('.unFollow').css('display', 'block');
                }else{
                    Msg('关注失败');
                }
            },
            error: function(){
                closeLoading();
                Msg();
            }
        })
    }else{
        Msg('请先选择案件');
    }
}
function reports(event){
    stopPro(event);
    if(ajbh != ''){
        layer.open({
            title: '研判报告意见建议',
            type: 1,
            area: ['80%','610px'],
            resize: false,
            content: $('#reportTextarea')
        });
        //window.location.href = 'report.html?ajbh=' + ajbh;
    }else{
        Msg('请先选择案件');
    }
}
//取消报告
function cancelReport(){
    $('.reportTextarea').val('');
    layer.closeAll();
}
//生成报告
function submitReport(){
    var str = $.trim($('.reportTextarea').val());
    $('.reportTextarea').val('');
    layer.closeAll();
    window.location.href = baseUrls + 'analysis/downloadReport?ajbh=' + ajbh + '&yjjy=' + str
}

function stopPro(event){
    var e = arguments.callee.caller.arguments[0]||event;
    if (e && e.stopPropagation) {
        e.stopPropagation();
    }else if(window.event) {
        window.event.cancelBubble = true;
    }
}
function changePattern(item){
    var Index = $(item).index();
    if( ajbh != ''){
        $(item).removeClass('liNormal').addClass('liActive').siblings().removeClass('liActive').addClass('liNormal');
        $('.listDiv>div').css('display','none');
        $('.listDiv>div').eq(Index).css('display','block');
        $('.lineSurvey').css({height: $('.tab-1').height() - 90 + 'px',overflow: 'auto'});
        if(Index == 1){
            //线勘数据查询
            if($.trim($('.casePolice-hoof').val()).length == 0){
                $.ajax({
                    type: 'get',
                    url: baseUrls + 'survey/'+ ajbh,
                    // url: baseUrls + 'survey/A5202015100002017080038',
                    beforeSend: function(){
                        Loading();
                    },
                    success: function(response){
                        closeLoading();
                        if(response.responseCode == '1000'){
                            //案件基本信息
                            if(response.content.ajList.length > 0){
                                $('.acceptanceNumber-hoof').val(Nulls(response.content.ajList[0].ajslh));
                                $('.caseNumber-hoof').val(Nulls(response.content.ajList[0].ajbh));
                                $('.caseStyle-hoof').val(Nulls(response.content.ajList[0].ajlb));
                                $('.crimeZone-hoof').val(Nulls(response.content.ajList[0].faqh));
                                $('.caseAdress-hoof').val(Nulls(response.content.ajList[0].fadd));
                                $('.caseTime-hoof').val(Nulls(response.content.ajList[0].fasjq) + ' ~ ' + Nulls(response.content.ajList[0].fasjz));
                                if(response.content.ajList[0].fasjq == null && response.content.ajList[0].fasjz == null){
                                    $('.caseTime-hoof').val('');
                                };
                                if(response.content.ajList[0].sfma == 0){
                                    $('.caseHomicide-hoof').val('是');
                                }else{
                                    $('.caseHomicide-hoof').val('否');
                                }
                                if(response.content.ajList[0].sfxa == 0){
                                    $('.caseCriminal-hoof').val('是');
                                }else{
                                    $('.caseCriminal-hoof').val('否');
                                }
                                $('.caseSolveTime-hoof').val(Nulls(response.content.ajList[0].pasj));
                                $('.latitudeLongitude-hoof').val(Nulls(response.content.ajList[0].jd)+ ' | ' + Nulls(response.content.ajList[0].wd));
                                if(response.content.ajList[0].jd == null && response.content.ajList[0].wd == null){
                                    $('.latitudeLongitude-hoof').val('');
                                };
                                $('.caseProcess-hoof').val(Nulls(response.content.ajList[0].ajfxgc));
                            }else{
                                $('.acceptanceNumber-hoof').val('');
                                $('.caseNumber-hoof').val('');
                                $('.caseStyle-hoof').val('');
                                $('.crimeZone-hoof').val('');
                                $('.caseAdress-hoof').val('');
                                $('.caseTime-hoof').val('');
                                $('.caseHomicide-hoof').val('');
                                $('.caseCriminal-hoof').val('');
                                $('.caseSolveTime-hoof').val('');
                                $('.latitudeLongitude-hoof').val('');
                                $('.caseProcess-hoof').val('');
                            }
                            //现场信息 线勘
                            if(response.content.xcxxList.length > 0){
                                $('.caseInquest-hoof').val(Nulls(response.content.xcxxList[0].kysjks)+ ' ~ ' +Nulls(response.content.xcxxList[0].kysjjs));
                                if(response.content.xcxxList[0].kysjks == null && response.content.xcxxList[0].kysjjs == null){
                                    $('.caseInquest-hoof').val('');
                                };
                                $('.caseAddress-hoof').val(Nulls(response.content.xcxxList[0].kydd));
                                if(response.content.xcxxList[0].tqqk == '2'){
                                    $('.caseWeather-hoof').val('晴');
                                }
                                if(response.content.xcxxList[0].xctj == '2'){
                                    $('.caseScene-hoof').val('无');
                                }
                                if(response.content.xcxxList[0].gztj == '1'){
                                    $('.caseLight-hoof').val('亮');
                                }
                                if(response.content.xcxxList[0].xcwpfd == '4'){
                                    $('.caseFlip-hoof').val('整齐');
                                }
                                $('.caseProtectTime-hoof').val(Nulls(response.content.xcxxList[0].bhsj));
                                $('.caseProtectPeople-hoof').val(Nulls(response.content.xcxxList[0].bhrxm));
                                $('.caseProtectMode-hoof').val(Nulls(response.content.xcxxList[0].bhcs));
                                $('.caseInspect-hoof').val(Nulls(response.content.xcxxList[0].kyjcqk));
                                if(response.content.xcxxList[0].swqks == '4'){
                                    $('.caseLost-hoof').val('无伤亡');
                                }
                                // $('.caseReport-hoof').val(Nulls(response.content.xcxxList[0].bhdw)); 暂无数据
                                $('.caseLegacy-hoof').val(Nulls(response.content.xcxxList[0].xcylw));
                                $('.caseSuggest-hoof').val(Nulls(response.content.xcxxList[0].xcczyjwz));
                                $('.caseCommand-hoof').val(Nulls(response.content.xcxxList[0].xczhry));
                                $('.caseInspectPeople-hoof').val(Nulls(response.content.xcxxList[0].kyjcry));
                                $('.caseOther-hoof').val(Nulls(response.content.xcxxList[0].qtddxcry));
                            }else{
                                $('.caseInquest-hoof').val('');
                                $('.caseAddress-hoof').val('');
                                $('.caseWeather-hoof').val('');
                                $('.caseScene-hoof').val('');
                                $('.caseLight-hoof').val('');
                                $('.caseFlip-hoof').val('');
                                $('.caseProtectTime-hoof').val('');
                                $('.caseProtectPeople-hoof').val('');
                                $('.caseProtectMode-hoof').val('');
                                $('.caseInspect-hoof').val('');
                                $('.caseLost-hoof').val('');
                                $('.caseReport-hoof').val('');
                                $('.caseLegacy-hoof').val('');
                                $('.caseSuggest-hoof').val('');
                                $('.caseCommand-hoof').val('');
                                $('.caseInspectPeople-hoof').val('');
                                $('.caseOther-hoof').val('');
                            }
                            //线勘报警基本信息
                            if(response.content.cjList.length > 0){
                                $('.casePolice-hoof').val(Nulls(response.content.cjList[0].jksj));
                                $('.caseComputer-hoof').val(Nulls(response.content.cjList[0].zpdw));
                                $('.caseReason-hoof').val(Nulls(response.content.cjList[0].kysy));
                            }else{
                                $('.casePolice-hoof').val('');
                                $('.caseComputer-hoof').val('');
                            }
                            //损失物品
                            $('.goodsContent-hoof').html('');
                            if(response.content.ssList.length > 0){
                                for(var i = 0; i < response.content.ssList.length; i++){
                                    $('.goodsContent-hoof').append('<li><strong>'+ (i + 1) +'</strong><strong title="'+ nulls(response.content.ssList[i].pm) +'">'+ nulls(response.content.ssList[i].pm) +'</strong><strong title="'+ nulls(response.content.ssList[i].cp)+ '  ' + nulls(response.content.ssList[i].xh) +'">'+ nulls(response.content.ssList[i].cp)+ '  ' + nulls(response.content.ssList[i].xh) +'</strong><strong title="'+ nulls(response.content.ssList[i].tzms) +'">'+ nulls(response.content.ssList[i].tzms) +'</strong><strong title="'+ nulls(response.content.ssList[i].sl) +'">'+ nulls(response.content.ssList[i].sl) +'</strong><strong title="'+ nulls(response.content.ssList[i].jzy) +'">'+ nulls(response.content.ssList[i].jzy) +'</strong></li>');
                                }
                            }
                            //受害人
                            $('.witnessContent-hoof').html('');
                            if(response.content.bhrList.length > 0){
                                for(var i = 0; i < response.content.bhrList.length; i++){
                                    $('.witnessContent-hoof').append('<li><strong>'+ (i + 1) +'</strong><strong title="'+ nulls(response.content.bhrList.xm) +'">'+ nulls(response.content.bhrList.xm) +'</strong><strong title="'+ nulls(response.content.bhrList.xb) +'">'+ nulls(response.content.bhrList.xb) +'</strong><strong title="'+ nulls(response.content.bhrList.nl) +'">'+ nulls(response.content.bhrList.nl) +'</strong><strong title="'+ nulls(response.content.bhrList.xzzxz) +'">'+ nulls(response.content.bhrList.xzzxz) +'</strong></li>');
                                }
                            }
                            //分析意见
                            if(response.content.fxList.length > 0){
                                $('.caseTarget-hoof').val(Nulls(response.content.fxList[0].xzdxms));
                                $('.caseTargetAdress-hoof').val(Nulls(response.content.fxList[0].zadd));
                                $('.caseTargetTime-hoof').val(Nulls(response.content.fxList[0].zasdms));
                                $('.caseTargetEntrance-hoof').val('进口：'+ nulls(response.content.fxList[0].zajkms) + ';' + '出口：' + nulls(response.content.fxList[0].zackms));
                                $('.caseTargetHands-hoof').val('窃取手段：'+ nulls(response.content.fxList[0].zagjms) + ';' + '侵入方式：' + nulls(response.content.fxList[0].qrfsms));
                            }else{
                                $('.caseTarget-hoof').val('');
                                $('.caseTargetAdress-hoof').val('');
                                $('.caseTargetTime-hoof').val('');
                                $('.caseTacaseTargetEntrancerget-hoof').val('');
                                $('.caseTargetHands-hoof').val('');
                            }
                        }else{
                            Msg();
                        }
                    },
                    error: function(){
                        closeLoading();
                        Msg();
                    }
                })
            }
        }else{

        }
    }else{
        Msg('请先选择案件');
    }
}
function ajtb(){
    if($.trim($('.caseNumber').val()).length > 0){
        $.ajax({
            type: 'put',
            url: baseUrls + 'case/'+ $.trim($('.caseNumber').val()),
            data: {pageIndex: 0},
            beforeSend: function(){
                Loading();
            },
            success: function(response){
                closeLoading();
                $('.ul-content').html('');
                $('#demo_pag1').html('');
                clearMsg();
                clearFile();
                $('.message .msgR').css({flex: '0 0 0', paddingLeft: '0'});
                $('.rImg').css('padding','0');
                if(response.responseCode == '1000'){
                    if(response.content.list.length > 0){
                        for(var i = 0; i< response.content.list.length; i++){
                            if(response.content.list[i].status == '1'){
                                $('.ul-content').append('<li onclick="getMsg(this)" onmouseup="shopping(this)" class="hasClue"  title="鼠标右键添加指令相关案件"><span class="firstSpan left">'+ response.content.list[i].ajbh +'</span><span class="secondSpan center">'+ response.content.list[i].ajmc +'</span><span class="right">'+ nulls(response.content.list[i].afkssj) +'</span></li>');
                            }else{
                                $('.ul-content').append('<li onclick="getMsg(this)" onmouseup="shopping(this)"  title="鼠标右键添加指令相关案件"><span class="firstSpan left">'+ response.content.list[i].ajbh +'</span><span class="secondSpan center">'+ response.content.list[i].ajmc +'</span><span class="right">'+ nulls(response.content.list[i].afkssj) +'</span></li>');
                            }
                        }
                    }else{
                        // mark('案件同步失败，请稍后再试！');
                        console.log(1);
                    }
                }else{
                    Msg('资源库暂无数据');
                }
            },
            error: function(){
                closeLoading();
                Msg('资源库暂无数据');
            }
        })
    }else{
        Msg('案件同步前请输入正确的案件编号！');
    }
}
//调用依图接口
function yitu(data){
    $.ajax({
        type: 'post',
        url: baseUrls + 'caseClue/carInfo',
        dataType: 'json',
        data: data,
        headers: {'Content-Type': 'application/json'},
        success: function(response){
            //console.log(JSON.parse(response.content).results);
        },
        error: function(){
            console.log('依图接口调用失败');
        }
    })
}

//附件类型切换
function chooseFileStyle(item){
    if($(item).val() == '嫌疑人'){
        $(item).parents('.allMessageList').find('.fileMsg').hide();
        $(item).parents('.allMessageList').find('.fileMsg').eq(0).show();
        if(typeArray[nowIndex] == 1){
            $(item).parents('.allMessageList').find('.enclosureT .fileMsg').eq(0).append('<div class="group clearfix"><div class="form-group form-groups"><label><b>*</b>嫌疑人出现时间</label><input type="text" class="form-control Input fileSixteen" id="video'+ nowIndex +'"></div></div>')
            //日期
            laydate.render({
                elem: '#video' + nowIndex,
                type: 'datetime',
                range: '~',
                theme: 'molv',//主题
                min: '1900-1-1 00:00:00',
                max: 1,
                format: 'yyyy-MM-dd HH:mm:ss',
                done: function(value, date, endDate){
                }
            });
        }
    }else if($(item).val() == '车辆'){
        $(item).parents('.allMessageList').find('.fileMsg').hide();
        $(item).parents('.allMessageList').find('.fileMsg').eq(1).show();
    }else if($(item).val() == '损失物品'){
        $(item).parents('.allMessageList').find('.fileMsg').hide();
        $(item).parents('.allMessageList').find('.fileMsg').eq(2).show();
    }else if($(item).val() == '缴获物品'){
        $(item).parents('.allMessageList').find('.fileMsg').hide();
        $(item).parents('.allMessageList').find('.fileMsg').eq(3).show();
    }else{
        $(item).parents('.allMessageList').find('.fileMsg').hide();
    }
}
function readpeopleMsg (){
    var readPeopleMsg = '<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value=""></div></div><div class="group clearfix"><div class="form-group"><label>人数</label><input type="text" class="form-control Input fileOne" readonly></div><div class="form-group"><label>年龄</label><input type="text" class="form-control Input fileTwo" readonly></div></div><div class="group clearfix"><div class="form-group"><label>性别</label><input type="text" class="form-control Input fileThree" readonly></div><div class="form-group"><label>身高</label><input type="text" class="form-control Input fileFour" readonly></div></div><div class="group clearfix"><div class="form-group"><label>上衣颜色</label><input type="text" class="form-control Input fileFive" readonly></div><div class="form-group"><label>上衣正面</label><input type="text" class="form-control Input fileSix" readonly></div></div><div class="group clearfix"><div class="form-group"><label>上衣背面</label><input type="text" class="form-control Input fileSeven" readonly></div><div class="form-group"><label>上衣侧面</label><input type="text" class="form-control Input fileEight" readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>上衣备注</label><input type="text" class="form-control Input fileEight" readonly></div></div><div class="group clearfix"><div class="form-group"><label>下身颜色</label><input type="text" class="form-control Input fileNine" readonly></div><div class="form-group"><label>下身正面</label><input type="text" class="form-control Input fileTen" readonly></div></div><div class="group clearfix"><div class="form-group"><label>下身背面</label><input type="text" class="form-control Input fileEleven" readonly></div><div class="form-group"><label>下身侧面</label><input type="text" class="form-control Input fileTwelve" readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>下身备注</label><input type="text" class="form-control Input fileThirteen" readonly></div></div><div class="group clearfix"><div class="form-group"><label>鞋颜色</label><input type="text" class="form-control Input fileFourteen" readonly></div><div class="form-group"><label>嫌疑人状态</label><input type="text" class="form-control Input filefifteen" readonly></div></div></div>',
        readcarMsg = '<div class="fileMsg"><div class="group clearfix"><div class="form-group"><label>车辆颜色</label><input type="text"class="form-control Input fileOne"readonly></div><div class="form-group"><label>型号</label><input type="text"class="form-control Input fileTwo"readonly></div></div><div class="group clearfix"><div class="form-group"><label>二轮车</label><input type="text"class="form-control Input Three"readonly></div><div class="form-group"><label>二轮车颜色</label><input type="text"class="form-control Input fileFour"readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>车牌</label><input type="text" class="form-control Input fileFive"></div></div></div>',
        lostMsg = '<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>损失物品说明</label><input type="text" class="form-control Input" class="fileOne"></div></div></div>',
        getMsg = '<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>缴获物品说明</label><input type="text" class="form-control Input" class="fileOne"></div></div></div>';
}